package com.pkx.cloud.fse7.dms.device.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.pkx.cloud.fse7.dms.device.entity.Device;
import com.pkx.cloud.fse7.dms.device.feign.DeviceFeign;
import com.pkx.cloud.fse7.dms.device.repo.DeviceMapper;
import com.pkx.cloud.fse7.dms.device.service.DeviceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 门禁设备 服务实现类
 *
 * @author ly
 * @since 2020-10-14
 */
@Service
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements DeviceService {

    @Autowired
    private DeviceFeign deviceFeign;
    /**
     * 分页列表
     *
     * @param device
     * @return
     */
    @Override
    public Page<Device> pageList(Page page, Device device) {
        LambdaQueryWrapper<Device> lambdaQueryWrapper = Wrappers.lambdaQuery(Device.class);
        return page(page, lambdaQueryWrapper);
    }

    /**
     * 列表查询
     *
     * @param device
     * @return
     */
    @Override
    public List<Device> listByEntity(Device device) {
        LambdaQueryWrapper<Device> lambdaQueryWrapper = Wrappers.lambdaQuery(Device.class);
        return list(lambdaQueryWrapper);
    }

    /**
     * 详情
     *
     * @param id
     * @return
     */
    @Override
    public Device selectById(Long id) {
        return getById(id);
    }

    @Override
    public String update(Device device) {
        return deviceFeign.update(device);
    }

    @Override
    public String add(Device device) {
        return deviceFeign.add(device);
    }

    @Override
    public String delete(String where) {
        return deviceFeign.delete(where);
    }
}
